package com.cloudsdo.cameratest.model;

import android.content.Context;

import com.arcsoft.face.ErrorInfo;
import com.arcsoft.face.FaceEngine;
import com.arcsoft.face.VersionInfo;
import com.cloudsdo.cameratest.model.StuData;

/**
 * -----------------------------------------------------------------
 * Copyright (C) 2014-2016, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * File: LoadService.java
 * Author: win7
 * Version: V100R001C01
 * Create: 2019/8/6 19:13
 * Changes (from 2019/8/6)
 * -----------------------------------------------------------------
 * 2019/8/6 : Create LoadService.java (win7);
 * -----------------------------------------------------------------
 */
public class LoadService implements Runnable {

    private Context context;

    public LoadService(Context context) {
        this.context = context;
    }

    @Override
    public void run() {
        int MAX_DETECT_NUM = 10;
        int orient= FaceEngine.ASF_OP_0_HIGHER_EXT;
        FaceEngine faceEngine = new FaceEngine();
        int afCode = faceEngine.init(context, FaceEngine.ASF_DETECT_MODE_VIDEO, orient,
                16, MAX_DETECT_NUM, FaceEngine.ASF_FACE_RECOGNITION | FaceEngine.ASF_FACE_DETECT | FaceEngine.ASF_LIVENESS);
        VersionInfo versionInfo = new VersionInfo();
        faceEngine.getVersion(versionInfo);
        if (afCode == ErrorInfo.MOK) {
            StuData.getInstance(context)
                    .setFaceEngine(faceEngine)
                    .loadFeatureFromDB();
            faceEngine.unInit();
        }else{
        }
    }
}
